﻿using HomagChina.CCT.BaseUI.DataModel;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using HomagGroup.BaseUI.Router;
using System.Collections.ObjectModel;
using static HomagChina.CCT.BaseUI.ProcessResourceInternal;
using static HomagChina.CCT.BaseUI.Utility;
using Application = System.Windows.Application;
using LocalText = HomagChina.Basic.CCT.ResourceLibrary.Properties.Resources;
using UserControl = System.Windows.Controls.UserControl;

namespace HomagChina.CCT.BaseUI.Router
{
    public class HomeRoute : NotifyPropertyChangedBase
    {
        public RouterItemDataModel HomeRouteModel { get; set; }

        public HomeRoute()
        {
            HomeRouteModel = new RouterItemDataModel()
            {
                ID = "Home",
                viewLabel = LocalText.Home,
                viewName = "Home",
                keepalive = true,
                viewModelName = "HomeViewModel",
                ViewModel = new HomeViewModel(),
                userControl = (UserControl)GetUserControlInstance("Home"),
                Image = GetIconBrush(Icon.Home),
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>
                {
                   new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.Exit, Position = 12, Icon = GetIconBrush(Icon.Close, ImageDecoration.Circle),
                        Command = new RelayCommand(() => { Application.Current.Shutdown(); })
                    },

                    new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.Error_message, Position = 11, Icon = GetResourceBrush("ErrorMessages"),
                       Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("ErrorMessage"); })
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.Tasks, Position = 10, Icon = GetResourceBrush("Task")
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.History, Position = 9, Icon = GetResourceBrush("history") ,
                        Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("TransHistory"); })
                    },
                  
                    new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.Settings, Position = 3, Icon= GetResourceBrush("Settings") ,
                        Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("Settings"); })
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.Statistics, Position = 2, Icon = GetResourceBrush("Statistics"),
                      Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("Statistics"); })
                    },
            
                    new FunctionKeyBarItemDataModel() {
                        Header =  LocalText.Info, Position = 1, Icon = GetIconBrush(Icon.Information, imageDecoration: ImageDecoration.Circle),
                        //Command = new RelayCommand(() => { new Utility().OpenInformationCommand(Handle_Search.GetSystemInfoMation()); })
                    }
                }
            };

            HomeRouteModel.userControl.DataContext = HomeRouteModel.ViewModel;
        }
    }
}